package com.steven.ourcontest.forum.api

import com.steven.ourcontest.chat.bean.ReportRes
import com.steven.ourcontest.forum.bean.DiscussInfoList
import com.steven.ourcontest.forum.bean.ForumInfo
import com.steven.ourcontest.forum.bean.ForumInfoList
import com.steven.ourcontest.net.BaseResponse
import com.steven.ourcontest.net.EmptyResponse
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.*

interface ForumApiService {

    @FormUrlEncoded
    @POST("/forum/list/hot")
    fun queryHotForumList(@Field("page") page: Long = 1L): Observable<BaseResponse<ForumInfoList>>

    @FormUrlEncoded
    @POST("/forum/list/new")
    fun queryNewForumList(@Field("page") page: Long = 1L): Observable<BaseResponse<ForumInfoList>>

    @POST("/forum/add")
    fun addForum(
        @Body body: RequestBody
    ): Observable<BaseResponse<EmptyResponse>>

    @FormUrlEncoded
    @POST("/forum/query")
    fun queryForumByFid(@Field("fid") fid: Long): Observable<BaseResponse<ForumInfo>>

    @FormUrlEncoded
    @POST("/forum/addHistory")
    fun addHistory(
        @Field("fid") fid: Long
    ): Observable<BaseResponse<EmptyResponse>>

    @FormUrlEncoded
    @POST("/forum/discuss/add")
    fun addDiscuss(
        @Field("fid") fid: Long,
        @Field("content") content: String
    ): Observable<BaseResponse<EmptyResponse>>

    @FormUrlEncoded
    @POST("/forum/discuss/list")
    fun queryDiscussList(
        @Field("forumId") forumId: Long
    ): Observable<BaseResponse<DiscussInfoList>>

    @POST("/complain/add")
    fun addComplain(
        @Body body: RequestBody
    ): Observable<BaseResponse<EmptyResponse>>

    @FormUrlEncoded
    @POST("/complain/query")
    fun queryComplain(
        @Field("lastCreateTime") lastCreateTime: Long
    ): Observable<BaseResponse<ReportRes>>

    @FormUrlEncoded
    @POST("/complain/update")
    fun updateComplain(
        @Field("id") id: Long
    ): Observable<BaseResponse<EmptyResponse>>
}